package com.qf.pojo;/*
 *保护你的大熊
 *2021/11/16
 *21:34
 */

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Arrays;
import java.util.Date;
import java.util.List;

public class User {

    @JsonProperty("new_id")

    private Integer id;

    @JsonInclude(JsonInclude.Include.NON_NULL) // 若"name==null" 忽略此属性
    private String name;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Boolean gender;

    @JsonIgnore // 生成json时，忽略此属性
    private List<User> userList;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Date birth;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String[] hobby;

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", gender=" + gender +
                ", userList=" + userList +
                ", birth=" + birth +
                ", hobby=" + Arrays.toString(hobby) +
                '}';
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Boolean getGender() {
        return gender;
    }

    public void setGender(Boolean gender) {
        this.gender = gender;
    }

    public Date getBirth() {
        return birth;
    }

    public void setBirth(Date birth) {
        this.birth = birth;
    }

    public String[] getHobby() {
        return hobby;
    }

    public void setHobby(String[] hobby) {
        this.hobby = hobby;
    }

    public List<User> getUserList() {
        return userList;
    }

    public void setUserList(List<User> userList) {
        this.userList = userList;
    }
}
